package com.nail.api.customMake.dao;

import com.nail.api.customMake.bean.GoodsPrice;
import com.nail.dao.IBaseDao;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * Created by jie on 2017/9/17.
 */
@Mapper
public interface IGoodsPriceDao extends IBaseDao<GoodsPrice>{

    @Select("select * from goods_price order by create_time desc limit #{begin},#{end}")
    public List<GoodsPrice> getGoodsPrices(@Param("begin") Integer begin, @Param("end") Integer end);

    @Update("update goods_price set is_able = #{isAble} where id = #{id}")
    public void setIsAble(@Param("id") Long id,@Param("isAble") Integer isAble);

    @Select("select * from goods_price where type = #{type} and id != #{id}")
    public GoodsPrice selectByIdAndType(@Param("id") Long id,@Param("type") Integer type);

    @Select("select * from goods_price where type = #{type}")
    public GoodsPrice getGoodsPricesByType(@Param("type") Integer type);
}
